package com.ymatou.query.trading.api.testcase;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetSellerOrderListCountBean;
import com.ymatou.query.trading.api.parameter.PackageDeliveryDomesticStatusFilter;
import com.ymatou.query.trading.api.parameter.args.GetSellerOrderListCountArguments;
import com.ymatou.query.trading.api.parameter.resp.GetSellerOrderListCountResp;
import com.ymatou.query.trading.api.parameter.results.GetSellerOrderListCountResult;
import com.ymatou.query.trading.api.parameter.results.GetSellerOrderListCountResult.SellerOrderStatusCountInfo;
import com.ymatou.query.trading.api.parameter.sp.I_Sp_GetSellerOrderListCount;
import com.ymatou.query.trading.api.parameter.sp.Sp_GetSellerOrderListCount_Full;
import com.ymatou.query.trading.api.parameter.sp.Sp_GetSellerOrderListCount_Simple;
import com.ymatou.query.trading.api.service.GetSellerOrderListCountCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymt.utils.tag.P3;
import com.ymttest.common.enums.LogisticsTypeEnum;
import com.ymttest.common.enums.OrderDateEnum;
import com.ymttest.common.enums.OrderStatusEnum;
import com.ymttest.common.enums.OrderTypeEnum;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;

/**
 * 获取卖家订单数量 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetSellerOrderListCount {

	private static GetSellerOrderListCountBean request;
	private static GetSellerOrderListCountCall getsellerorderlistcountcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取卖家订单数量");
	}

	@Before
	public void caseUp() {

		request = new GetSellerOrderListCountBean();
		getsellerorderlistcountcall = new GetSellerOrderListCountCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getsellerorderlistcountcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	private void verify(){
		GetSellerOrderListCountResp expectResponse = new GetSellerOrderListCountResp();
		constructExpectedResponse(request,expectResponse);
		GetSellerOrderListCountResp actualResponse = getsellerorderlistcountcall.getSellerOrderListCountResp();
		Map<String,Integer> expect = expectResponse.getAllRecordCountDic();
		Map<String,Integer> actual = actualResponse.getAllRecordCountDic();
		if(expect == null){
			DataUtil.verify(null, actual, "验证AllRecordCountDic == null");
		}else{
			boolean sameSize = expect.size()==actual.size();
			DataUtil.verify(expect.size(), actual.size(), "验证AllRecordCountDic.size()");
			if(sameSize){
				Iterator<String> it = expect.keySet().iterator();
				while(it.hasNext()){
					String expKey = it.next();
					int expValue = expect.get(expKey);
					boolean exist = actual.containsKey(expKey);
					DataUtil.verify(true, exist, "验证AllRecordCountDic中是否存在状态: ["+expKey+"]");
					if(exist){
						DataUtil.verify(expValue, actual.get(expKey), "验证AllRecordCountDic中状态为["+expKey+"]的数量");
					}
				}
			}
		}
	}
	
	public void constructExpectedResponse(GetSellerOrderListCountBean request,GetSellerOrderListCountResp response){
		GetSellerOrderListCountArguments args = GetArguments(request);
//		GetParameters(args);
		GetSellerOrderListCountResult result = Execute(args);
		Map<String,Integer> AllRecordCountDic = new HashMap<String, Integer>();
		int total = 0;
		for(GetSellerOrderListCountResult.SellerOrderStatusCountInfo o : result.getInfos()){
			String key = String.valueOf(o.getiTradingStatus());
			if(Integer.valueOf(key) == OrderStatusEnum.SellerAccept.getValue()){
				if(o.isbPaidInFull()){
					AllRecordCountDic.put(String.valueOf(OrderStatusEnum.SellerAccept.getValue()), o.getNum());
				}else{
					AllRecordCountDic.put(String.valueOf(OrderStatusEnum.OrderPostPay.getValue()), o.getNum());
				}
			}else{
				if(AllRecordCountDic.containsKey(key)){
					AllRecordCountDic.put(key, AllRecordCountDic.get(key)+o.getNum());
				}else{
					AllRecordCountDic.put(key, o.getNum());
				}
			}
			total += o.getNum();
		}
		AllRecordCountDic.put("0", total);//总订单量
		if(false == DataUtil.isNullOrEmpty(request.getOrderStatusList())){
			request.getOrderStatusList().forEach(os->{
				String t = String.valueOf(os);
				if(!AllRecordCountDic.containsKey(t)){
					AllRecordCountDic.put(t, 0);
				}
			});
		}
		response.setAllRecordCountDic(AllRecordCountDic);
	}
	
	@SuppressWarnings("rawtypes")
	public GetSellerOrderListCountResult Execute(GetSellerOrderListCountArguments args){
		GetSellerOrderListCountResult rs = new GetSellerOrderListCountResult();
		List<SellerOrderStatusCountInfo> infos = new ArrayList<GetSellerOrderListCountResult.SellerOrderStatusCountInfo>();
		I_Sp_GetSellerOrderListCount sp = null;
		if(args.isSimpleQuery()){
			sp = new Sp_GetSellerOrderListCount_Simple();
		}else{
			sp = new Sp_GetSellerOrderListCount_Full();
		}
		List<Map> results = sp.execute(args);
		if(false == DataUtil.isNullOrEmpty(results)){
			for(Map m:results){
				GetSellerOrderListCountResult.SellerOrderStatusCountInfo o = new GetSellerOrderListCountResult.SellerOrderStatusCountInfo();
				DataUtil.mapToBean(o, m);
				infos.add(o);
			}
		}
		rs.setInfos(infos);
		return rs;
	}
	
	
	public static GetSellerOrderListCountArguments GetArguments(GetSellerOrderListCountBean request){
		GetSellerOrderListCountArguments args = new GetSellerOrderListCountArguments();
		args.setSellerId(request.getSellerId());
		args.setSimpleQuery(true);
		if(!DataUtil.Stringg.IsNullOrWhiteSpace(request.getSearchKeyWord())){
			args.setKeyword(request.getSearchKeyWord());
			args.setSimpleQuery(false);
		}
		SetCatalogStatus(args,request);
		if (!DataUtil.isNullOrEmpty(args.getCatalogStatus())){
			args.setSimpleQuery(false);
		}
		SetOrderTypeAndShangou(args,request);
		if(args.getOrderType() > 3){
			args.setSimpleQuery(false);
		}
		SetTime(args, request);
		SetTimeout(args, request);
		
		args.setOrderStatus(request.getOrderStatusList());
		args.setSalesRefundOrderOnly(DataUtil.bool2Int(request.isSalesRefundOrderOnly()));
		return args;
	}
	
	private static void SetTimeout(GetSellerOrderListCountArguments args,GetSellerOrderListCountBean request) {
		args.setTimeoutBegin1(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD)  + " 00:00:00");
		args.setTimeoutBegin2(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD)  + " 00:00:00");
		args.setTimeoutBegin3(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD)  + " 00:00:00");
		args.setTimeoutEnd1(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD)  + " 00:00:00");
		args.setTimeoutEnd2(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD)  + " 00:00:00");
		args.setTimeoutEnd3(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD)  + " 00:00:00");
		if(request.getOverTimeLimitDic() == null || request.getOverTimeLimitDic().size()==0){
			return;
		}
		String now = YMTDateUtil.getBeforeOrNextDay(0);
		Iterator<Integer> it = request.getOverTimeLimitDic().keySet().iterator();
		while(it.hasNext()){
			int key = it.next();
			String value = request.getOverTimeLimitDic().get(key);
			if(key == OrderStatusEnum.AccountPaid.getValue()){
				args.setTimeoutType(1);
				if(value.contains("*")){
					args.setTimeoutType1((byte) 1);
					args.setTimeoutBegin1(GetBeginTime(now, value, false));
					args.setTimeoutEnd1(GetEndTime(now, value, false));
				}else{
					args.setTimeoutType1((byte) 2);
					args.setTimeoutBegin1(GetBeginTime(now, value, true));
					args.setTimeoutEnd1(GetEndTime(now, value, true));
				}
			}else if(key == OrderStatusEnum.OrderPostPay.getValue()){
				args.setTimeType(1);
				if(value.contains("*")){
					args.setTimeoutType2((byte) 1);
					args.setTimeoutBegin2(GetBeginTime(now, value, false));
					args.setTimeoutEnd2(GetEndTime(now, value, false));
				}else{
					args.setTimeoutType2((byte) 2);
					args.setTimeoutBegin2(GetBeginTime(now, value, true));
					args.setTimeoutEnd2(GetEndTime(now, value, true));
				}
			}else if(key == OrderStatusEnum.SellerAccept.getValue()){
				args.setTimeType(1);
				if(value.contains("*")){
					args.setTimeoutType3((byte) 1);
					args.setTimeoutBegin3(GetBeginTime(now, value, false));
					args.setTimeoutEnd3(GetEndTime(now, value, false));
				}else{
					args.setTimeoutType3((byte) 2);
					args.setTimeoutBegin3(GetBeginTime(now, value, true));
					args.setTimeoutEnd3(GetEndTime(now, value, true));
				}
			}
		}
	}
	
	private static String GetBeginTime(String now, String value, boolean single) {
		if (DataUtil.Stringg.isNullOrEmpty(value)) {
			value = DataUtil.Stringg.Empty;
		}
		if (single) {
			return now;
		}
		String[] s = value.split("*");
		if(s.length<2){
			return now;
		}else{
			return YMTDateUtil.getBeforeOrNextMinutes(now, toMinute(s[1]), YMTDateUtil.YMDHMS);
		}
	}
	
	private static int toMinute(String s){
		if(DataUtil.isNullOrEmpty(s) || !StringUtils.isNumeric(s)){
			return 1;
		}
		return -1 * Integer.valueOf(s);
	}
	
	private static String GetEndTime(String now, String value, boolean single) {
		if (DataUtil.Stringg.isNullOrEmpty(value)) {
			value = DataUtil.Stringg.Empty;
		}
		if (single) {
			return YMTDateUtil.getBeforeOrNextMinutes(now, toMinute(value), YMTDateUtil.YMDHMS);
		}
		String[] s = value.split("*");
		return YMTDateUtil.getBeforeOrNextMinutes(now, toMinute(s[0]), YMTDateUtil.YMDHMS);
	}
	
	private static void SetTime(GetSellerOrderListCountArguments args,GetSellerOrderListCountBean request) {
		if (request.getBeginTime() != null && request.getEndTime() != null) {
			if (request.getOrderDateEnum() != null
					&& request.getOrderDateEnum() != OrderDateEnum.Unknown
							.getValue()) {
				args.setTimeType(request.getOrderDateEnum());
			} else// 兼容性代码 后期要去除 cpx 2014年10月13日
			{
				args.setTimeType(OrderDateEnum.CreateDate.getValue());
			}
			args.setBeginTime(request.getBeginTime());
			args.setEndTime(request.getEndTime());
		}else{
			args.setBeginTime(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD + " 00:00:00"));
			args.setEndTime(YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD + " 00:00:00"));
		}

	}
	
	private static void SetCatalogStatus(GetSellerOrderListCountArguments args,GetSellerOrderListCountBean request){
		if(request.getPackageDeliveryDomesticStatusFilter() != null){
			PackageDeliveryDomesticStatusFilter o = request.getPackageDeliveryDomesticStatusFilter();
			if(o.isDomesticDelivered()&&!o.isDomesticUndelivered()){
				args.setDomesticDelivered(1);
			}else if(!o.isDomesticDelivered()&&o.isDomesticUndelivered()){
				args.setDomesticDelivered(0);
			}
			List<Integer> catalogStatus = new ArrayList<Integer>();
			catalogStatus.add(LogisticsTypeEnum.PackageDelivery.getValue());
			args.setCatalogStatus(catalogStatus);
		}else{
			args.setCatalogStatus(request.getLogisticsTypeList());
		}
	}

	  private static void SetOrderTypeAndShangou(GetSellerOrderListCountArguments args,GetSellerOrderListCountBean request)
      {
          if (DataUtil.isNullOrEmpty(request.getOrderTypeList()))
          {
              if (request.getIsShangouOrder()!=null)
              {
                  args.setOrderType(1);
                  args.setShangou(request.getIsShangouOrder());
              }
          }
          else
          {
              if (request.getOrderTypeList().size()== 1) //单类型
              {
            	  int i = request.getOrderTypeList().get(0);
            	  if(i == OrderTypeEnum.Spot.getValue()){
            		  args.setOrderType(6);
            	  }else if(i == OrderTypeEnum.Shangou.getValue()){
            		  args.setOrderType(3);
            		  args.setShangou(true);
            	  }else if(i == OrderTypeEnum.Purchasing.getValue()){
            		  args.setOrderType(7);
            	  }
              }
              else if (request.getOrderTypeList().size()== 2)//多类型
              {
                  if (request.getOrderTypeList().contains(OrderTypeEnum.Spot.getValue()) &&
                      request.getOrderTypeList().contains(OrderTypeEnum.Shangou.getValue()))//如果同时包含现货与扫货订单并排除包含全部类型的情况
                  {
                      args.setOrderType(4);
                  }
                  if (request.getOrderTypeList().contains(OrderTypeEnum.Spot.getValue()) &&
                      request.getOrderTypeList().contains(OrderTypeEnum.Purchasing.getValue()))//如果同时包含现货与下单器订单并排除包含全部类型的情况
                  {
                      args.setOrderType(2);
                      args.setShangou(false);
                  }
                  if (request.getOrderTypeList().contains(OrderTypeEnum.Shangou.getValue()) &&
                      request.getOrderTypeList().contains(OrderTypeEnum.Purchasing.getValue()))//如果同时包含扫货与下单器订单并排除包含全部类型的情况
                  {
                      args.setOrderType(5);
                  }
              }
          }
      }
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_001() {
		Logger.start(true,"获取卖家非闪购订单数量成功");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(0,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 闪购
			request.setIsShangouOrder(false);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			request.setLogisticsTypeList(LogisticsTypeList);
			// 订单时间类型
			request.setOrderDateEnum(OrderDateEnum.CreateDate.getValue());
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			request.setOrderStatusList(OrderStatusList);
			// 订单类型
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(0);
			request.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			request.setOverTimeLimitDic(map);
			// 查询关键词
			request.setSearchKeyWord("21");
			// 卖家ID
			request.setSellerId(SellerId);
			request.setPackageDeliveryDomesticStatusFilter(null);
			request.setSalesRefundOrderOnly(false);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_002() {
		Logger.start(true,"获取卖家闪购订单数量成功");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 是否闪购
			request.setIsShangouOrder(true);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			request.setLogisticsTypeList(LogisticsTypeList);
			// 订单时间类型
			request.setOrderDateEnum(OrderDateEnum.Unknown.getValue());
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			request.setOrderStatusList(OrderStatusList);
			// 订单类型
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(0);
			request.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			request.setOverTimeLimitDic(map);
			// 查询关键词
			request.setSearchKeyWord("24");
			// 卖家ID
			request.setSellerId(SellerId);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_003() {
		Logger.start(true,"sellerid=null,获取卖家非闪购订单数量成功");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 闪购
			request.setIsShangouOrder(false);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			request.setLogisticsTypeList(LogisticsTypeList);
			// 订单时间类型
			request.setOrderDateEnum(OrderDateEnum.CreateDate.getValue());
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			request.setOrderStatusList(OrderStatusList);
			// 订单类型
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(0);
			request.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			request.setOverTimeLimitDic(map);
			// 查询关键词
			request.setSearchKeyWord("21");
			// 卖家ID
//			request.setSellerId(SellerId);
			request.setPackageDeliveryDomesticStatusFilter(null);
			request.setSalesRefundOrderOnly(false);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_004() {
		Logger.start(true,"什么都不传,获取卖家非闪购订单数量成功");
		try {
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_005() {
		Logger.start(true,"开始时间大于结束时间,获取卖家非闪购订单数量成功");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(1,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 闪购
			request.setIsShangouOrder(false);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			request.setLogisticsTypeList(LogisticsTypeList);
			// 订单时间类型
			request.setOrderDateEnum(OrderDateEnum.CreateDate.getValue());
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			request.setOrderStatusList(OrderStatusList);
			// 订单类型
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(0);
			request.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			request.setOverTimeLimitDic(map);
			// 查询关键词
			request.setSearchKeyWord("21");
			// 卖家ID
			request.setSellerId(SellerId);
			request.setPackageDeliveryDomesticStatusFilter(null);
			request.setSalesRefundOrderOnly(false);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_006() {
		Logger.start(true,"验证LogisticsTypeList");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(0,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 闪购
			request.setIsShangouOrder(false);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			LogisticsTypeList.add(LogisticsTypeEnum.XloboBondedDelivery.getValue());
			LogisticsTypeList.add(LogisticsTypeEnum.PackageDelivery.getValue());
			request.setLogisticsTypeList(LogisticsTypeList);
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_007() {
		Logger.start(true,"验证订单状态为101的订单筛选");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			OrderStatusList.add(OrderStatusEnum.OrderPostPay.getValue());
			request.setOrderStatusList(OrderStatusList);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_008() {
		Logger.start(true,"验证订单状态为17的订单筛选");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			OrderStatusList.add(OrderStatusEnum.SellerAccept.getValue());
			request.setOrderStatusList(OrderStatusList);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_009() {
		Logger.start(true,"验证订单状态为不存在的状态的订单筛选");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			OrderStatusList.add(404);
			request.setOrderStatusList(OrderStatusList);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_010() {
		Logger.start(true,"验证订单类型筛选");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 订单类型
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(OrderTypeEnum.Purchasing.getValue());
			request.setOrderTypeList(OrderTypeList);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_011() {
		Logger.start(true,"验证[订单状态对应的超时时间]的筛选,key=1");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			map.put(1, "20*30");
			request.setOverTimeLimitDic(map);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_012() {
		Logger.start(true,"验证[PackageDeliveryDomesticStatusFilter],filter.setDomesticDelivered(true),filter.setDomesticUndelivered(false)");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			PackageDeliveryDomesticStatusFilter filter = new PackageDeliveryDomesticStatusFilter();
			filter.setDomesticDelivered(true);
			filter.setDomesticUndelivered(false);
			request.setPackageDeliveryDomesticStatusFilter(filter);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_013() {
		Logger.start(true,"验证[PackageDeliveryDomesticStatusFilter],filter.setDomesticDelivered(false),filter.setDomesticUndelivered(true)");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			PackageDeliveryDomesticStatusFilter filter = new PackageDeliveryDomesticStatusFilter();
			filter.setDomesticDelivered(false);
			filter.setDomesticUndelivered(true);
			request.setPackageDeliveryDomesticStatusFilter(filter);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_014() {
		Logger.start(true,"验证[PackageDeliveryDomesticStatusFilter],filter.setDomesticDelivered(false),filter.setDomesticUndelivered(false)");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			PackageDeliveryDomesticStatusFilter filter = new PackageDeliveryDomesticStatusFilter();
			filter.setDomesticDelivered(false);
			filter.setDomesticUndelivered(false);
			request.setPackageDeliveryDomesticStatusFilter(filter);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_GetSellerOrderListCount_015() {
		Logger.start(true,"验证SalesRefundOrderOnly=true的筛选");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(SellerId);
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-100,YMTDateUtil.YMDTHMS_STRING);
			request.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(-1,YMTDateUtil.YMDTHMS_STRING);
			request.setEndTime(EndTime);
			request.setSalesRefundOrderOnly(true);
			// 发送请求
			getsellerorderlistcountcall.setData(request);
			getsellerorderlistcountcall.callService();
			Logger.comment("getsellerorderlistcountcall send:" + getsellerorderlistcountcall.getEntityString());
			Logger.comment("getsellerorderlistcountcall response:" + getsellerorderlistcountcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getsellerorderlistcountcall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}